package com.gxan.web.controller;

import com.alibaba.fastjson.JSONObject;
import com.gxan.common.R;
import com.gxan.service.HumanService;
import com.gxan.service.impl.HumanServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet("/review/batchPass")
public class BatchPassServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        //1.获取前端传递的所有id/ids数组
        String[] ids = request.getParameterValues("ids");
        //2.调用service
        HumanService humanService = new HumanServiceImpl();
        R r = humanService.batchPass(ids);
        //3.响应
        //设置JSON格式和编码
        response.setContentType("application/json;charset=utf-8");
        response.getWriter().write(JSONObject.toJSONString(r));
        response.getWriter().flush();
        response.getWriter().close();
    }
}
